﻿

using IotContract.Dtos.Clients;
using IotContract.Dtos.Remotes.Request;
using IotContract.Dtos.Servers.Pushs;
using IotContract.Enums;
using IotContract.Models;
using IotContract.Models.Clients;
using IotContract.Models.Process;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IotContract.Interfaces;
/// <summary>
/// 设备数据服务入口
/// </summary>
public interface IServerMainManager
{
    /// <summary>
    /// 推送设备,获取写入指令
    /// </summary>
    /// <param name="equipList"></param>
    /// <returns></returns>
    Task<List<OperationWriteCommand>> PushEquips(List<IPushEquip> equipList);

     /// <summary>
     /// 获取设备信息
     /// </summary>
     /// <param name="command"></param>
     /// <returns></returns>
    Task<List<T>> GetEquips<T>(ClientRequestCommand command) where T:IPushEquip;

    /// <summary>
    /// 清理设备
    /// </summary>
    /// <returns></returns>
    Task ClearEquips();

    /// <summary>
    /// 获取所有设备通用数据
    /// </summary>
    /// <param name="ids"></param>
    /// <returns></returns>
    Task<List<T>> GetEquips<T>(List<ClientRequestCommand> commands) where T : IPushEquip;

    /// <summary>
    /// 添加控制命令
    /// </summary>
    /// <param name="command"></param>
    /// <returns></returns>
    Task<bool> AddControl(ClientControlCommand command);
    /// <summary>
    /// 添加写入指令
    /// </summary>
    /// <param name="command"></param>
    /// <returns></returns>
    Task<bool> AddWrite(OperationWriteCommand command);
    /// <summary>
    /// 添加写入指令
    /// </summary>
    /// <param name="commands"></param>
    /// <returns></returns>
    Task<bool> AddWrites(IEnumerable<OperationWriteCommand> commands);
    /// <summary>
    /// 添加报警
    /// </summary>
    /// <param name="warns"></param>
    /// <returns></returns>
    Task<bool> AddWarns(IEnumerable<IotEquipWarnDto> warns);
    /// <summary>
    /// 读取所有程序控制指令
    /// </summary>
    /// <param name="programId"></param>
    /// <param name="equipId"></param>
    /// <returns></returns>
    Task<ConcurrentQueue<ClientControlCommand>> ReadControl(long programId);
    /// <summary>
    /// 获取进程调度数据
    /// </summary>
    /// <param name="provider"></param>
    /// <returns></returns>
    Task<List<ProcessBaseData>> GetProcessDatas(ProcessProviderCommand provider);
    /// <summary>
    /// 添加进程调度任务
    /// </summary>
    /// <param name="process"></param>
    /// <param name="type"></param>
    /// <returns></returns>
    Task<string> AddProcessJob(ProcessBaseData process, ProcessProviderType type);

    /// <summary>
    /// 完成任务
    /// </summary>
    /// <param name="fmsCommitTrayRequest"></param>
    /// <returns></returns>
    Task<string> CompleteJob(FmsJobCompleteRequest fmsCommitTrayRequest);

    /// <summary>
    /// 移除进程调度任务
    /// </summary>
    /// <param name="data"></param>
    /// <param name="type"></param>
    /// <returns></returns>
    Task<string> RemoveProcessJob(ProcessBaseData data, ProcessProviderType type);

    /// <summary>
    /// 执行相关调度数据
    /// </summary>
    /// <param name="data"></param>
    /// <param name="type"></param>
    /// <returns></returns>
    Task<string> ExecuteProcessData(ProcessBaseData data, ProcessProviderType type);
    /// <summary>
    /// 初始化相关数据
    /// </summary>
    /// <returns></returns>
    Task<string> Initial();

}
